package org.zjt.platform.springbootreactivedemo.config.endpoint;

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

import java.util.Random;

/**
 * Description: 健康指标响应
 *
 * @author juntao.zhang
 * Date: 2018-06-13 上午10:26
 * @see
 */
@Component
public class MyHealthIndicator implements HealthIndicator {

    private Random random = new Random();

    @Override
    public Health health() {
        if (random.nextInt(10) %2 ==0)
            return Health.down().withDetail("code","网络异常").build();
        return Health.up().build();
    }
}
